'''
Author: cw
Date: 2025-07-22
Description: ...
'''
import time

def build_text_response(to_user: str, from_user: str, content: str) -> str:
    """构建文本回复消息"""
    xml_response = f"""
    <xml>
        <ToUserName><![CDATA[{to_user}]]></ToUserName>
        <FromUserName><![CDATA[{from_user}]]></FromUserName>
        <CreateTime>{int(time.time())}</CreateTime>
        <MsgType><![CDATA[text]]></MsgType>
        <Content><![CDATA[{content}]]></Content>
    </xml>
    """
    return xml_response


def build_image_response(to_user: str, from_user: str, media_id: str) -> str:
    """构建图片回复消息"""
    xml_response = f"""
    <xml>
        <ToUserName><![CDATA[{to_user}]]></ToUserName>
        <FromUserName><![CDATA[{from_user}]]></FromUserName>
        <CreateTime>{int(time.time())}</CreateTime>
        <MsgType><![CDATA[image]]></MsgType>
        <Image>
            <MediaId><![CDATA[{media_id}]]></MediaId>
        </Image>
    </xml>
    """
    return xml_response